package com.holly.common.listener;

import android.view.View;

import java.util.Calendar;

/**
 * @author Joey Huang（QQ:273179370）
 * @created 2016/9/7
 */
public abstract class OnNoDoubleClickListener implements View.OnClickListener {
    public static final int MIN_CLICK_DELAY_TIME = 1000;
    private long lastClickTime = 0;
    public int mDelayTime =MIN_CLICK_DELAY_TIME;

    @Override
    public void onClick(View view) {
        long currentTime = Calendar.getInstance().getTimeInMillis();
        if (currentTime - lastClickTime > mDelayTime) {
            lastClickTime = currentTime;
            onNoDoubleClick(view);
        }
    }

    public abstract void onNoDoubleClick(View view);
}
